home *** CD-ROM | disk | FTP | other *** search
Wrap
// Copyright (C) 1997-2002 Alias|Wavefront, // a division of Silicon Graphics Limited. // // The information in this file is provided for the exclusive use of the // licensees of Alias|Wavefront. Such users have the right to use, modify, // and incorporate this code into other products for purposes authorized // by the Alias|Wavefront license agreement, without fee. // // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. // global proc deleteReferenceObject() // // Description // Looks at the selection list for the first piece of // geometry and then proceeeds to: // delete the referenceObject for each // surface under the selectedObject. // { // Get the relevant selected objects (transforms or geometryShapes) string $selectedObjects[] = `ls -sl -type transform -type geometryShape`; if (size($selectedObjects) >= 1) { // Get the geometryShapeNodes for the first selected object. string $originalShapeNodes[] = `ls -sl -dagObjects -type geometryShape $selectedObjects[0]`; if (size($originalShapeNodes) >= 1) { // There is at least one geometryShape node so proceed // Iterate through all the shape nodes for ($shapeNode in $originalShapeNodes) { // If referenceObject attribute is connected, find out the // node it is connected to and delete it. string $connectedNode[] = `listConnections -shapes true ($shapeNode + ".referenceObject")`; if (size($connectedNode) == 1) { int $interHist = `getAttr ($connectedNode[0] + ".intermediateObject")`; // // If the reference object is an intermediate object // (ie, the undeformed original shape), then just // break the connection. // Otherwise, delete the reference shape. // // We used to try to optimize by not making a reference object // but connecting to an undeformed upstream node. If we load // an old file (2.0) that has such a connection and the user // tries to "delete reference object" we will warn the user // and break the connection. // if ($interHist) { string $warningMsg = ("Reference object " + $connectedNode[0] + " is an intermediate object. This object will no longer be a reference object for " + $shapeNode + " but it will not be deleted."); warning($warningMsg); disconnectAttr ($connectedNode[0] + ".message") ($shapeNode + ".referenceObject"); } else { delete $connectedNode[0]; } } } } } }